import * as THREE from 'three'
export class EdgesLine {
    constructor (scene, mesh, color) {
        this.scene = scene
        this.mesh = mesh
        this.color = color

        this.init()
    }

    init () {
        const edgesGeometry = new THREE.EdgesGeometry(this.mesh.geometry)
        const material = new THREE.LineBasicMaterial({
            color: this.color
        })
        const line = new THREE.LineSegments(edgesGeometry, material)
        // 把目标小物体的位置 旋转缩放 拷贝给线条
        line.position.copy(this.mesh.position)
        line.rotation.copy(this.mesh.rotation)
        line.scale.copy(this.mesh.scale)
        // 而不是把线条的属性拷贝给物体
        // line.matrix.decompose(this.mesh.position, this.mesh.rotation, this.mesh.scale)
        this.scene.add(line)
    }
}